package com.solocredit.finance.data.dev.take

import android.content.Context
import android.os.Build
import com.google.gson.Gson
import com.solocredit.finance.data.dev.utils.FlexiMolaApp
import com.solocredit.finance.data.dev.utils.FlexiMolaHdwUtil
import com.solocredit.finance.data.dev.utils.FlexiMolaNetUtil
import com.solocredit.finance.data.dev.utils.gzipString

/**
 * Hardware
 */
class TakeFlexiMolaHdw(val context: Context) {

    fun takeFlexiMolaHdw(): String? {
        return try {
           val data = hashMapOf<String, Any>().apply {
                put("operatingSystem", "ANDROID")
                put("model", Build.MODEL.toString())
                put("serial", "")
                put("productionDate", Build.TIME.toString())
                put("sdkVersion", Build.VERSION.SDK_INT.toString())
                put("phoneType", FlexiMolaApp.phType(context))
                put("versionCode", FlexiMolaApp.verCode(context))
                put("versionName", FlexiMolaApp.verName(context))
                put("androidId", FlexiMolaApp.anroiId(context))
                put("telephony", FlexiMolaApp.sioName(context))
                put("isVpn", FlexiMolaNetUtil.vsta(context))
                put("isProxyPort", FlexiMolaNetUtil.isvapro())
                put("isDebug", FlexiMolaApp.isDg(context))
                put("simState", FlexiMolaApp.siState(context))
                put("root", FlexiMolaHdwUtil.chrot())
                put("physicalSize", FlexiMolaHdwUtil.pysiz(context))
                put("displayLanguage", FlexiMolaApp.disLang())
                put("iso3Language", FlexiMolaApp.isoLang())
                put("iso3Country", FlexiMolaApp.isoCtry())
                put("networkOperatorName", FlexiMolaApp.sioName(context))
                put("networkType", FlexiMolaApp.wiType(context))
                put("timeZoneId", FlexiMolaApp.tzID())
                put("elapsedRealtime", FlexiMolaApp.elaptime())
                put("sensorList", FlexiMolaHdwUtil.sorList(context))
                put("lastBootTime", FlexiMolaApp.lastBTime())
                put("rootJailbreak", FlexiMolaHdwUtil.chrot())
                put("keyboard", FlexiMolaHdwUtil.kbard(context))
                put("isSimulator", FlexiMolaHdwUtil.isVirso())
                put("dbm", FlexiMolaHdwUtil.gmdb(context)) //
                put("phoneNumber", "")
            }
            Gson().toJson(data).trim().gzipString()

        } catch (e: java.lang.Exception) {
            null
        }
    }
}